<?php

include('inc/init.php');

$smarty->template_dir = 'templates';
$smarty->assign('title', $title);

$id=$_GET['id'];
$curridx=$_GET['r'];
$currpage=$_GET['p'];

$package = $db->prepare("select * from ats_package where id='".$id."'");
$package->execute();
$package->setFetchMode(PDO::FETCH_ASSOC);

$dest = $db->prepare("select id,country from ats_destination");
$dest->execute();
$dest->setFetchMode(PDO::FETCH_ASSOC);

$cat = $db->prepare("select id, package from ats_package_category");
$cat->execute();
$cat->setFetchMode(PDO::FETCH_ASSOC);

$iten = $db->prepare("select * from ats_itinerary where packageid='".$id."' order by orderseq");
$iten->execute();
$iten->setFetchMode(PDO::FETCH_ASSOC);

// assign to smarty
$smarty->assign('package', $package);
$smarty->assign('dest', $dest);
$smarty->assign('cat', $cat);
$smarty->assign('iten', $iten);
$smarty->assign('save_mode', 'u');
$smarty->assign('currpage', $currpage);
$smarty->assign('curridx', $curridx);

// assign to smarty
$smarty->display('packageeditor.tpl');
?>